package com.fortune.service.impl;

import com.fortune.dao.DUnitDao;
import com.fortune.dto.in.dUnit.DUnitAddDto;
import com.fortune.dto.in.dUnit.DUnitEditDto;
import com.fortune.dto.in.dUnit.DUnitListDto;
import com.fortune.service.DUnitService;
import com.fortune.vo.dProduct.DProduceUnit;
import com.fortune.vo.dUnit.DUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DUnitServiceImpl implements DUnitService {
    @Autowired
    private DUnitDao dUnitDao;

    /**
     * 查询商品单位
     * @param did
     * @return
     */
    @Override
    public List<DUnit> queryDunit(String did, DUnitListDto listDto) {
        return dUnitDao.queryDunit(did,listDto);
    }

    /**
     * 查询商品单位个数
     * @param did
     * @param listDto
     * @return
     */
    @Override
    public int queryDunitCount(String did, DUnitListDto listDto) {
        return dUnitDao.queryMunitCount(did,listDto);
    }

    /**
     * 添加商品单位
     * @param did
     * @param addDto
     * @return
     */
    @Override
    public int addDunit(String did, DUnitAddDto addDto) {
        return dUnitDao.addDunit(did,addDto);
    }

    /**
     * 编辑商品单位
     * @param did
     * @param editDto
     * @return
     */
    @Override
    public int editDunit(String did, DUnitEditDto editDto) {
        return dUnitDao.editDunit(did,editDto);
    }

    /**
     * 删除商品单位
     * @param did
     * @param dUnitId
     * @return
     */
    @Override
    public int deleteDunit(String did, String dUnitId) {
        return dUnitDao.deleteDunit(did,dUnitId);
    }

    /**
     * 查询该名称是否存在
     * @param did
     * @param addDto
     * @return
     */
    @Override
    public int queryDunitExist(String did, DUnitAddDto addDto) {
        return dUnitDao.queryDunitExist(did,addDto);
    }

    /**
     * 编辑时查询该名称是否存在
     * @param did
     * @param editDto
     * @return
     */
    @Override
    public int queryEditDunitExist(String did, DUnitEditDto editDto) {
        return dUnitDao.queryEditDunitExist(did,editDto);
    }

    /**
     * 查询商品单位
     * @param did
     * @return
     */
    @Override
    public List<DProduceUnit> queryProduceDunit(String did) {
        return dUnitDao.queryProduceDunit(did);
    }


}
